package com.example.bili.service.impl;

import com.example.bili.dao.CommentsDao;
import com.example.bili.dao.CommentsMapper;
import com.example.bili.entity.Comments;
import com.example.bili.service.CommentsService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentsServicelmpl implements CommentsService {
    @Resource
    private CommentsMapper commentsMapper;
    @Resource
    private CommentsDao commentsDao;
    @Override
    public List<Comments> getall() {
        return commentsMapper.getall();
    }

    @Override
    public boolean add(int userId,String content) {
        return commentsMapper.add(userId, content)>0;
    }


    @Override
    public List<Comments> getCmtNum(int becment) {
        return commentsDao.getCmtNum(becment);
    }

    @Override
    public List<Comments> getCmtAll(int becment) {
        return commentsDao.getCmtAll(becment);
    }

    @Override
    public List<Comments> getCmtZi(int becment, int fuId) {
        return commentsDao.getCmtZi(becment, fuId);
    }

    @Override
    public boolean addCmt(Comments cmt) {
        return commentsDao.addCmt(cmt)>0;
    }

    @Override
    public boolean delCmt(int id) {
        return commentsDao.delCmt(id)>0;
    }

}
